const asyncHttpGet = async url => {
    return new Promise((resolve, reject) => {
        wx.request({
            url: url,
            method: 'GET',
            success: resp => {
                resolve(resp)
            },
            fail: resp => {
                reject(resp)
            }
        })
    });
}

const asyncHttpPost = async (url, data) => {
    return new Promise((resolve, reject) => {
        wx.request({
            url: url,
            data: data,
            method: 'POST',
            success: resp => {
                resolve(resp)
            },
            fail: resp => {
                reject(resp)
            }
        })
    })
}

module.exports = {
    asyncHttpGet: asyncHttpGet,
    asyncHttpPost: asyncHttpPost
}